package com.sq.partner.manager.service;

import java.util.List;

import com.sq.partner.manager.common.Result;
import com.sq.partner.manager.mybatis.model.GatewayApp;
import com.sq.partner.manager.mybatis.model.GatewayAppTranstype;
import com.sq.partner.manager.mybatis.model.TreeDto;
import com.sq.partner.manager.util.Page;

public interface IGatewayAppService {

	/**
	 * 查询所有app
	 * @return List<GatewayApp>
	 * @throws Exception
	 */
	public List<GatewayApp> queryAllAppList() throws Exception;
	
	/**
	 * 添加或修改app
	 * @param flag 用来标记是要“更新”还是“保存”
	 * @param app
	 * @throws Exception
	 */
	public void saveOrUpdateApp(String flag, GatewayApp app) throws Exception;

	/**
	 * 条件查询app
	 * 
	 * @param appVo
	 * @return
	 * @throws Exception
	 */
	List<GatewayApp> queryList(GatewayApp appVo) throws Exception;

	/**
	 * 按照appName分页查找app
	 * @param page
	 * @param appName
	 * @return
	 * @throws Exception
	 */
	public Page queryPage(Page page, String appName) throws Exception;
	
	/**
	 * 按照appId查询与之关联的appTranstype
	 * @param appTranstype
	 * @return
	 * @throws Exception
	 */
	public List<GatewayAppTranstype> queryAppTranstypeByFkAppId(GatewayAppTranstype appTranstype) throws Exception;

	/**
	 * 删除app
	 * @param appId
	 * @throws Exception
	 */
	public Result delApp(String appId) throws Exception;
	
	/**
	 * 根据appId删除对应的app
	 * @param appId
	 * @return
	 * @throws Exception
	 */
	public GatewayApp queryAppByAppId(String appId) throws Exception;
	
	/**
	 * 检查传入的transCode在传入的app中是否存在
	 * @param appId
	 * @param transCode
	 * @return
	 * @throws Exception
	 */
	public GatewayAppTranstype checkTransCodeIfUsedInOneApp(String appId,String transCode) throws Exception;
	
	/**
	 * 根据appTranstypeId删除对应的appTranstype
	 * @param AppTranstypeId
	 */
	public Result delAppTranstypeByAppTranstypeId(Long appTranstypeId) throws Exception;
	
	/**
	 * 添加appTranstype
	 * @param appTranstype
	 * @throws Exception
	 */
	public void saveAppTranstype(GatewayAppTranstype appTranstype) throws Exception;
	
	/**
	 * 查询传入的合作伙伴的合作伙伴子机构
	 * @param parentChannelCode
	 * @return
	 * @throws Exception
	 */
	public List<TreeDto> querySubChannelTreeByParentChannelCode(String parentChannelCode) throws Exception;
	
	public List<GatewayApp> loadApplicationData()throws Exception;
}